
<div class="span12">
    <div class="box box-color box-bordered">
        <div class="box-title">
            <h3>
                <i class="icon-table"></i>
                Equipo
            </h3>
            <div class="actions">
                <?php if (myCapability::testcap($caps, myCapability::C('CAP_M_ADMIN_ORDER'))) { ?>
                    <a href="#mdlOrder" role="button" class="btn" data-toggle="modal"><i class="icon-table"></i></a>
                <?php } ?>
                <?php if (myCapability::testcap($caps, myCapability::C('CAP_M_ADMIN_FILTER'))) { ?>
                    <!--a href="#mdlFilter" role="button" class="btn" data-toggle="modal"><i class="icon-search"></i></a-->
                <?php } ?>
                <?php if (myCapability::testcap($caps, myCapability::C('CAP_M_ADMIN_EXCEL'))) { ?>
                    <a href="<?php echo url_for('/staff/excelStaff');?>" role="button" class="btn" ><i class="icon-download-alt"></i></a>
                <?php } ?>
              
            </div>
        </div>
        <div class="box-content nopadding">
            
            <?php //echo $userOrderCount;die();
            
            if($userOrderCount !=0){
            ?>
            <table class="table table-bordered dataTable dataTable-scroll-x">
                <thead>
                    <tr>
                        <?php 
                        foreach ($userTableOrder as $value) {?>
                            
                       
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==24 && $value['UserTableOrder'][0]['visible']==1){?><th>Nombre</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==25 && $value['UserTableOrder'][0]['visible']==1){?><th>Zona Vendedor</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==26 && $value['UserTableOrder'][0]['visible']==1){?><th>Cargo</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==27 && $value['UserTableOrder'][0]['visible']==1){?><th>Total Locales</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==28 && $value['UserTableOrder'][0]['visible']==1){?><th>Vta Totales</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==29 && $value['UserTableOrder'][0]['visible']==1){?><th>Vta Únidades</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==30 && $value['UserTableOrder'][0]['visible']==1){?><th>Cobertura Semanal</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==31 && $value['UserTableOrder'][0]['visible']==1){?><th>Cobertura Mensual</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==32 && $value['UserTableOrder'][0]['visible']==1){?><th>Visitas Día</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==33 && $value['UserTableOrder'][0]['visible']==1){?><th>Checklist %</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==34 && $value['UserTableOrder'][0]['visible']==1){?><th>Precios</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==35 && $value['UserTableOrder'][0]['visible']==1){?><th>Máximo</th><?php }?>
                        <?php if($value['UserTableOrder'][0]['id_tablecolumn']==36 && $value['UserTableOrder'][0]['visible']==1){?><th>Mínimo</th><?php }?>
                        
                        
                        <?php }?>
                    </tr>
                </thead>
                <tbody>
                    
                        <?php
                        $dataArray = array();
                        $i = 0;
                        foreach ($staff as $value) {

                            $dataArray[$i][]['nombre'] = $value['name'];
                            $dataArray[$i][]['zona'] = $value['name'];
                            $dataArray[$i][]['cargo'] = $value['name'];
                            $dataArray[$i][]['totalLocales'] = $value['name'];
                            $dataArray[$i][]['vtaTotal'] = $value['name'];
                            $dataArray[$i][]['vtaUnidades'] = $value['name'];
                            $dataArray[$i][]['cSemanal'] = $value['name'];
                            $dataArray[$i][]['cMes'] = $value['name'];
                            $dataArray[$i][]['visitas'] = $value['name'];
                            $dataArray[$i][]['checklist'] = $value['name'];
                            $dataArray[$i][]['precios'] = $value['name'];
                            $dataArray[$i][]['maximo'] = $value['name'];
                            $dataArray[$i][]['minimo'] = $value['name'];
                            $i++;
                        }


                        for ($x = 0; $x < $i; $x++) {
                            ?>
                            <tr>

                                        <?php foreach ($userTableOrder as $value) { ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 24 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][0]['nombre']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 25 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][1]['zona']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 26 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][2]['cargo']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 27 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][3]['totalLocales']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 28 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][4]['vtaTotal']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 29 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][5]['vtaUnidades']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 30 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][6]['cSemanal']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 31 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][7]['cMes']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 32 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][8]['visitas']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 33 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][9]['checklist']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 34 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][10]['precios']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 35 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][11]['maximo']; ?></td><?php } ?>
                                            <?php if ($value['UserTableOrder'][0]['id_tablecolumn'] == 36 && $value['UserTableOrder'][0]['visible']==1) { ?><td><?php echo $dataArray[$x][12]['minimo']; ?></td><?php } ?>
                                        <?php }
                                        ?>
                            </tr>
                            <?php
                        }
                        ?>

                </tbody>
            </table>
            
            <?php }else{ ?>  
            
            <table class="table table-bordered dataTable dataTable-scroll-x">
                <thead>
                    <tr>
                        <th>Nombre</th>
                        <th>Zona Vendedor</th>
                        <th>Cargo</th>
                        <th>Total Locales</th>
                        <th>Vta Totales</th>
                        <th>Vta Únidades</th>
                        <th>Cobertura Semanal</th>
                        <th>Cobertura Mensual</th>
                        <th>Visitas Día</th>
                        <th>Checklist %</th>
                        <th>Precio</th>
                        <th>Máximo</th>
                        <th>Mínimo</th>
                    </tr>
                </thead>
                <tbody>
                        
                    <?php foreach ($staff as $value) { ?>

                        <tr>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                            <td><?php echo $value['name'];?></td>
                        </tr>
                    <?php } ?>

                </tbody>
            </table>
            
            
            <?php }?>
        </div>
    </div>
</div>